package com.shiguiwu.springmybatis.spring.lifecycle.instance;

import com.shiguiwu.springmybatis.spring.lifecycle.definition.User;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;

/**
 * @description: process
 * @author: stone
 * @date: Created by 2021/3/24 20:59
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.spring.lifecycle.instance
 */
public class UserBeanPostProcessor implements InstantiationAwareBeanPostProcessor {

    @Override
    public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
        System.out.println("调用InstantiationAwareBeanPostProcessor》》》》》》》》》》》》》");
        if (User.class.isAssignableFrom(beanClass)) {
            User user = new User();
            user.setName("石贵武！！");
            return user;
        }
        return null;
    }
}
